<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/11/9
  Time: 10:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
  <head>
    <title>$Title$</title>
  </head>

  <script type="application/javascript" src="./static/js/jquery-1.8.3.min.js"></script>
  <script type="application/javascript">
        function test(id) {
              $.ajax({
                  url:"/user/deleUser",
                  data:{
                      userId:id
                  },
                  type:"POST",
                  dataType:"json",
                  success:function (data) {
                        console.log(data)
                        // eval(data):将json文本转 json对象
                        if(data.cord === 200){
                            alert(data.msg)
                            location.href="/index"
                        }
                  }
              })
        };

        function seleUserr(id) {
                $.ajax({
                     url:"/user/getUserByid",
                     data:{
                         userId:id
                     },
                     type:"POST",
                     dataType:"json",
                     success :function (data) {
                        console.log(data)
                    },
                    error:function (data) {
                        alert(1)
                    }
                })
        }


  </script>
  <body>
        <%--Rest风格--%>

        <button onclick="test(102)">删除</button>
        <button onclick="seleUserr(96)">c查看</button>

      <a href="/user/restUrl/1/lisi">Rest风格</a>

        <%--json  {"name":"lisi"}--%>
      <a href='/user/restUrl/{"userName":"lisi","userPassword":"123"}'>Rest风格对象</a>

        <form action="/user/toUpFile" method="post" enctype="multipart/form-data">
            <label>用户名：</label>
            <input type="text" name="userName">
            <label>密码</label>
            <input type="text" name="userPassword">
            <label>文件</label>
            <input type="file" name="pic_file">
            <label>文件2</label>
            <input type="file" name="pic_file">
            <input type="submit" value="提交">
        </form>


  </body>
</html>
